package com.rds.system.service.impl;

import com.rds.common.utils.uuid.SnowFlakeUtils;
import com.rds.system.common.AbstractService;
import com.rds.system.domain.RdaDownload;
import com.rds.system.domain.RdaDownloadDetail;
import com.rds.system.mapper.RdaDownloadMapper;
import com.rds.system.service.IRdaDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RdaDownloadServiceImpl extends AbstractService<RdaDownload> implements IRdaDownloadService  {

    @Autowired
    private RdaDownloadMapper rdaDownloadMapper;

    @Override
    public int insertDownload(RdaDownload rdaDownload) throws Exception {
        return rdaDownloadMapper.insertDownload(rdaDownload);
    }

    @Override
    public int deleteByIds(Long[] ids) throws Exception {
        return rdaDownloadMapper.deleteByIds(ids);
    }

    @Override
    public List<RdaDownload> findRdaDownloadsByIds(Long[] ids) throws Exception {
        return rdaDownloadMapper.findRdaDownloadsByIds(ids);
    }

    @Override
    public List<RdaDownloadDetail> findRdaDownloadDetailsById(Long downloadId) {
        return rdaDownloadMapper.findRdaDownloadDetailsById(downloadId);
    }

    @Override
    public int insertDownloadDetail(RdaDownloadDetail rdaDownloadDetail) {
        rdaDownloadDetail.setId(SnowFlakeUtils.nextId());
        return rdaDownloadMapper.insertDownloadDetail(rdaDownloadDetail);
    }
}
